g08aef
g08aef
© Numerical Algorithms Group, 2002.
Purpose
G08AEF Friedman two-way analysis of variance on k matched samples
Synopsis
[fr,p,ifail] = g08aef(x<,ifail>)
Description
The Friedman test investigates the score differences between k
matched samples of size n, the scores in the ith sample being
denoted by:
x ,x ,...,x .
i1 i2 in
(Thus the sample scores may be regarded as a two-way table with k
rows and n columns.) The hypothesis under test, H , often called
0
the null hypothesis, is that the samples come from the same
population, and this is to be tested against the alternative
hypothesis H that they come from different populations.
1
The test is based on the observed distribution of score rankings
between the matched observations in different samples.
The test proceeds as follows:
(a) The scores in each column are ranked, r denoting the rank
ij
within column j of the observation in row i. Average ranks
are assigned to tied scores.
(b) The ranks are summed over each row to give rank sums
n
--
t = > r , for i=1,2,...,k.
i -- ij
j=1
(c) The Friedman test statistic FR is computed, where
k
12 -- 1 2
FR= ------- > {t - -n(k+1)} .
nk(k+1) -- i 2
i=1
G08AEF returns the value of FR, and also an approximation, p, to
the significance of this value. (FR approximately follows a
2
(chi) distribution, so large values of FR imply rejection of
k-1
H ). H is rejected by a test of chosen size (alpha) if
0 0
p<(alpha). The approximation p is acceptable unless k=4 and n<5,
or k=3 and n<10, or k=2 and n<20; for k=3 or 4, tables should be
consulted; for k=2 the Sign test (see G08AAF) or Wilcoxon test
(see G08AGF) is in any case more appropriate.
Parameters
g08aef
Required Input Arguments:
x (:,:) real
Optional Input Arguments: <Default>
ifail integer -1
Output Arguments:
fr real
p real
ifail integer